home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 2.iso
/
STUTTGART
/
UTIL
/
SCREEN
/
CURSES01
/
minix
/
h
/
curses
next >
Wrap
Text File
|
1992-02-27
|
15KB
|
353 lines
/****************************************************************/
/* CURSES.H */
/* Header file for definitions and declarations for the */
/* PCcurses package. This should be #include'd in all user */
/* programs. */
/****************************************************************/
/* This version of curses is based on ncurses, a curses version */
/* originally written by Pavel Curtis at Cornell University. */
/* I have made substantial changes to make it run on IBM PC's, */
/* and therefore consider myself free to make it public domain. */
/* Bjorn Larsson (...mcvax!enea!infovax!bl) */
/****************************************************************/
/* 1.0: Release: 870515 */
/****************************************************************/
#ifdef ARCH
#ifndef __STDIO_H
#include <stdio.h>
#endif
#endif
/* general definitions */
#define mvwclrtobot mvwclbt
#define mvwclrtoeol mvwcleol
#define TRUE 1 /* booleans */
#define FALSE 0
#define ERR 1 /* general error flag */
#define OK 0 /* general OK flag */
/* functions defined as macros */
#define getch() wgetch(stdscr) /* using macroes allows you to use */
#define ungetch(c) wungetch(c) /* #undef getch/ungetch in your */
/* programs to use MSC getch() and */
/* ungetch() routines */
#define getyx(win,y,x) (y = (win)->_cury, x = (win)->_curx)
#ifndef max
#define max(a,b) (((a) > (b)) ? (a) : (b))
#endif
#ifndef min
#define min(a,b) (((a) < (b)) ? (a) : (b))
#endif
/* video attribute definitions */
#define A_ALTCHARSET 0x2000
#define A_BLINK 0x0100
#define A_BLANK 0
#define A_BOLD 0x0200
#define A_DIM 0
#define A_PROTECT 0
#define A_REVERSE 0x0400
#define A_STANDOUT 0x0800
#define A_UNDERLINE 0x1000
/* function and keypad key definitions */
#define KEY_BREAK 0x101 /* Not on PC */
#define KEY_DOWN 0x102 /* The four arrow keys */
#define KEY_UP 0x103
#define KEY_LEFT 0x104
#define KEY_RIGHT 0x105
#define KEY_HOME 0x106 /* Home key (upward+left arrow) */
#define KEY_BACKSPACE 0x107 /* Not on PC */
#define KEY_F0 0x108 /* Function keys. Space for */
#define KEY_F(n) (KEY_F0+(n)) /* 64 keys is reserved. */
#define KEY_DL 0x148 /* Not on PC */
#define KEY_IL 0x149 /* Insert line */
#define KEY_DC 0x14a /* Delete character */
#define KEY_IC 0x14b /* Insert char or enter insert mode */
#define KEY_EIC 0x14c /* Exit insert char mode */
#define KEY_CLEAR 0x14d /* Clear screen */
#define KEY_EOS 0x14e /* Clear to end of screen */
#define KEY_EOL 0x14f /* Clear to end of line */
#define KEY_SF 0x150 /* Scroll 1 line forward */
#define KEY_SR 0x151 /* Scroll 1 line backwards (reverse) */
#define KEY_NPAGE 0x152 /* Next page */
#define KEY_PPAGE 0x153 /* Previous page */
#define KEY_STAB 0x154 /* Set tab */
#define KEY_CTAB 0x155 /* Clear tab */
#define KEY_CATAB 0x156 /* Clear all tabs */
#define KEY_ENTER 0x157 /* Enter or send (unreliable) */
#define KEY_SRESET 0x158 /* soft (partial) reset (unreliable) */
#define KEY_RESET 0x159 /* reset or hard reset (unreliable) */
#define KEY_PRINT 0x15a /* print or copy */
#define KEY_LL 0x15b /* home down or bottom (lower left) */
#define KEY_ABORT 0x15c /* Abort/Terminate key (any) */
#define KEY_SHELP 0x15d /* Short help */
#define KEY_LHELP 0x15e /* Long help */
/* color attributes
* use the A_COLOR macro to specify foreground and background colors.
* For example, to set the stdscr to use green characters on a yellow
* background, you would say:
* attrset( A_COLOR(A_GREEN, A_YELLOW) );
*/
#define A_COLOR(fore,back) (((fore) << 8) | ((back) <<12 ) )
/* primary colors */
#define A_BLACK 0
#define A_BLUE 4
#define A_GREEN 2
#define A_RED 1
/* the "intensity" bit
* Warning: If used on the background color, the intensity bit
* will cause the text to blink. This reduces the number of
* background colors from 16 to 8. (There is a hardware-dependent
* method around this problem, but PC Curses does not support it.)
*/
#define A_INTENSE 8
/* secondary colors */
#define A_CYAN 6 /* blue-green */
#define A_MAGENTA 5 /* purple */
#define A_BROWN 3 /* (or dark yellow) */
#define A_WHITE 7 /* white (or light gray) */
/* "light" colors */
#define A_GRAY (A_INTENSE|A_BLACK)
#define A_LBLUE (A_INTENSE|A_BLUE)
#define A_LGREEN (A_INTENSE|A_GREEN)
#define A_LCYAN (A_INTENSE|A_CYAN)
#define A_LRED (A_INTENSE|A_RED)
#define A_LMAGENTA (A_INTENSE|A_MAGENTA)
#define A_YELLOW (A_INTENSE|A_BROWN)
#define A_BRIGHTWHITE (A_INTENSE|A_WHITE)
#define COLOR_ORANGE A_LRED
#define COLOR_MAGENTA A_MAGENTA
#define COLOR_RED A_RED
#define COLOR_BLUE A_BLUE
#define COLOR_GREEN A_GREEN
#define COLOR_GREY A_GRAY
#define COLOR_YELLOW A_YELLOW
#define COLOR_CYAN A_CYAN
#define COLOR_WHITE A_WHITE
#define COLOR_TAN A_BROWN
/* type declarations */
typedef char bool; /* boolean type */
typedef struct
{
int _cury; /* current pseudo-cursor */
int _curx;
int _maxy; /* max coordinates */
int _maxx;
int _begy; /* origin on screen */
int _begx;
int _flags; /* window properties */
int _attrs; /* attributes of written characters */
int _colors; /* screen colors, forgrund and back */
int _tabsize; /* tab character size */
bool _clear; /* causes clear at next refresh */
bool _leave; /* leaves cursor as it happens */
bool _scroll; /* allows window scrolling */
bool _nodelay; /* input character wait flag */
bool _keypad; /* flags keypad key mode active */
int **_line; /* pointer to line pointer array */
int *_minchng; /* First changed character in line */
int *_maxchng; /* Last changed character in line */
int _regtop; /* Top/bottom of scrolling region */
int _regbottom;
} WINDOW;
/* External variables */
extern int LINES; /* terminal height */
extern int COLS; /* terminal width */
extern WINDOW *curscr; /* the current screen image */
extern WINDOW *stdscr; /* the default screen window */
extern unsigned char ACS_ULCORNER; /* terminal dependent block grafic */
extern unsigned char ACS_LLCORNER; /* charcters. Forget IBM, we are */
extern unsigned char ACS_URCORNER; /* independent of their charset. :-) */
extern unsigned char ACS_LRCORNER;
extern unsigned char ACS_RTEE;
extern unsigned char ACS_LTEE;
extern unsigned char ACS_BTEE;
extern unsigned char ACS_TTEE;
extern unsigned char ACS_HLINE;
extern unsigned char ACS_VLINE;
extern unsigned char ACS_PLUS;
extern unsigned char ACS_S1;
extern unsigned char ACS_S9;
extern unsigned char ACS_DIAMOND;
extern unsigned char ACS_CKBOARD;
extern unsigned char ACS_DEGREE;
extern unsigned char ACS_PLMINUS;
extern unsigned char ACS_BULLET;
extern unsigned char ACS_LARROW;
extern unsigned char ACS_RARROW;
extern unsigned char ACS_DARROW;
extern unsigned char ACS_UARROW;
extern unsigned char ACS_BOARD;
extern unsigned char ACS_LANTERN;
extern unsigned char ACS_BLOCK;
/* for tty input emulation mode */
#if 0
extern int _ttyflags;
#define T_RAW 01
#define T_CRMOD 02
#define T_ECHO 04
#define T_NONL 010
#endif
#if 0
/* _scradr is used to determine the screen update method.
* this is still experimental.
*/
extern int _scradr;
#define T_BIOS 0 /* use bios updating */
#define T_DIRECT 0xffff /* direct update, figure out type */
#define T_MA 0xb000 /* direct update, assume monochrome */
#define T_CGA 0xb800 /* direct update, assume cga */
#define T_EGA 0xa800 /* direct update, assume ega */
#endif
/* PCcurses function declarations */
extern int addch(); /* put char in stdscr */
extern int addstr(); /* put string in stdscr */
extern void attrset(); /* set stdscr char attributes */
extern void attroff(); /* clear attribute(a) stdscr */
extern void attron(); /* add attribute(s) stdscr */
extern int baudrate(); /* compatibility dummy */
extern void beep(); /* sound bell */
extern void box(); /* draw a box around a window */
extern void cbreak(); /* set terminal cbreak mode */
extern void clear(); /* clear stdscr */
extern void clearok(); /* marks a window for screen clear */
extern int clrtobot(); /* clear end of stdscr */
extern int clrtoeol(); /* clear end of line in stdscr */
extern void crmode(); /* set terminal cbreak mode */
extern void cursoff(); /* turns off hardware cursor */
extern void curson(); /* turns on hardware cursor */
extern int delch(); /* delete a char in stdscr */
extern int deleteln(); /* delete a line in stdscr */
extern void delwin(); /* delete a window or a subwindow */
extern void doupdate(); /* update physical screen */
extern void echo(); /* set terminal echo mode */
extern int endwin(); /* cleanup and finitialization */
extern void erase(); /* erase stdscr */
extern int erasechar(); /* return char kill character */
extern int fixterm(); /* compatibility dummy */
extern void flash(); /* flash terminal screen */
extern void flushinp(); /* kill pending keyboard input */
extern int getstr(); /* get string to stdscr and buffer */
extern int gettmode(); /* compatibility dummy */
extern void idlok(); /* use ins/del line (dummy) */
extern int initscr(); /* curses initialization */
extern int inch(); /* get char at stdscr cursor */
extern int insch(); /* insert character in stdscr */
extern int insertln(); /* insert new line in stdscr */
extern void keypad(); /* marks a window for keypad usage */
extern int killchar(); /* return line kill character */
extern char *longname(); /* terminal description */
extern void leaveok(); /* marks window for cursor 'leave' */
extern void meta(); /* marks window for meta (dummy) */
extern int move(); /* move cursor in stdscr */
extern int mvaddch(); /* move & put char in stdscr */
extern int mvaddstr(); /* move & put string in stdscr */
extern int mvclrtobot(); /* move & clear end of stdscr */
extern int mvclrtoeol(); /* move & clear lineend in stdscr */
extern int mvcur(); /* move terminal cursor */
extern int mvdelch(); /* move & delete a char in stdscr */
extern int mvdeleteln(); /* move & delete a line in stdscr */
extern int mvgetch(); /* move & get char to stdscr */
extern int mvgetstr(); /* move & get string to stdscr */
extern int mvinch(); /* move & get char at stdscr cursor */
extern int mvinsch(); /* move & insert char in stdscr */
extern int mvinsertln(); /* move & insert new line in stdscr */
extern int mvprintw(); /* move & print string in stdscr */
extern int mvscanw(); /* move & get values via stdscr */
extern int mvwaddch(); /* move & put char in a window */
extern int mvwaddstr(); /* move & put string in a window */
extern int mvwclrtobot(); /* move & clear end of a window */
extern int mvwclrtoeol(); /* move & clear lineend in a window */
extern int mvwdelch(); /* move & delete a char in a window */
extern int mvwdeleteln(); /* move & delete a line in a window */
extern int mvwgetch(); /* move & get char to a window */
extern int mvwgetstr(); /* move & get string to a window */
extern int mvwinch(); /* move & get char at window cursor */
extern int mvwinsch(); /* move & insert char in a window */
extern int mvwinsertln(); /* move & insert new line in window */
extern int mvwin(); /* move window */
extern int mvwprintw(); /* move & print string in a window */
extern int mvwscanw(); /* move & get values via a window */
extern WINDOW *newwin(); /* create a window */
extern void nl(); /* set terminal cr-crlf map mode */
extern void nocbreak(); /* unset terminal cbreak mode */
extern void nocrmode(); /* unset terminal cbreak mode */
extern void nodelay(); /* marks window for no input wait */
extern void noecho(); /* unset terminal echo mode */
extern void nonl(); /* unset terminal cr-crlf map mode */
extern void noraw(); /* unset raw terminal mode */
extern void overlay(); /* overlay one window on another */
extern void overwrite(); /* overwrite one window on another */
extern int printw(); /* print string in stdscr */
extern void raw(); /* set raw terminal mode */
extern void refrbrk(); /* set screen refresh break mode */
extern void refresh(); /* refresh stdscr */
extern int resetterm(); /* compatibility dummy */
extern int resetty(); /* restore terminal I/O modes */
extern int saveoldterm(); /* compatibility dummy */
extern int saveterm(); /* compatibility dummy */
extern int savetty(); /* save terminal I/O modes */
extern int scanw(); /* get values via stdscr */
extern void scroll(); /* scroll region in a window */
extern void scrollok(); /* marks a window to allow scroll */
extern int setsrcreg(); /* define stdscr's scroll region */
extern int setterm(); /* compatibility dummy */
extern int setupterm(); /* set up terminal (no-op) */
extern void standend(); /* start normal chars in stdscr */
extern void standout(); /* start standout chars in stdscr */
extern WINDOW *subwin(); /* create a sub-window */
extern int tabsize(); /* set/get tabsize of stdscr */
extern void touchwin(); /* mark a window as modified */
extern char *unctrl(); /* char-to-string converter */
extern int waddch(); /* put char in a window */
extern int waddstr(); /* put string in a window */
extern void wattroff(); /* clear attribute(a) in window */
extern void wattron(); /* add attribute(s) in window */
extern void wattrset(); /* set window char attributes */
extern int wbox(); /* draw a box inside a window */
extern void wclear(); /* clear a window */
extern int wclrtobot(); /* clear end of a window */
extern int wclrtoeol(); /* clear end of line in a window */
extern int wdelch(); /* delete a char in a window */
extern int wdeleteln(); /* delete a line in a window */
extern void werase(); /* erase a window */
extern int wgetch(); /* get char to a window */
extern int wgetstr(); /* get string to window and buffer */
extern int winch(); /* get char at window cursor */
extern int winsch(); /* insert character in a window */
extern int winsertln(); /* insert new line in a window */
extern int wmove(); /* move cursor in a window */
extern void wnoutrefresh(); /* create screen image, w/o display */
extern int wprintw(); /* print string in a window */
extern void wrefresh(); /* refresh screen */
extern int wscanw(); /* get values via a window */
extern int wsetsrcreg(); /* define a window's scroll region */
extern void wstandend(); /* start normal chars in window */
extern void wstandout(); /* start standout chars in window */
extern int wtabsize(); /* set/get tabsize of a window */
extern int wungetch(); /* character push-back */